package com.tianji.learning.service;

import com.tianji.common.domain.dto.PageDTO;
import com.tianji.common.domain.query.PageQuery;
import com.tianji.learning.domain.dto.LearningPlanDTO;
import com.tianji.learning.domain.po.LearningLesson;
import com.baomidou.mybatisplus.extension.service.IService;
import com.tianji.learning.domain.vo.LearningLessonVO;
import com.tianji.learning.domain.vo.LearningPlanPageVO;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * <p>
 * 学生课程表 服务类
 * </p>
 *
 * @author srj
 * @since 2025-06-27
 */
public interface ILearningLessonService extends IService<LearningLesson> {

    void addUserLessons(Long userId, List<Long> courseIds);

    /**
     * 创建学习计划
     * @param planDTO
     */
    void createLearningPlan(@NotNull @Min(1) Long courseId, @NotNull @Range(min = 1, max = 50) Integer freq);

    /**
     * 查询我的学习计划
     * @param pageQuery
     */
    LearningPlanPageVO queryMyPlan(PageQuery pageQuery);

    PageDTO<LearningLessonVO> queryMyLessons(PageQuery query);

    /**
     * 2- 查询我最近正在学习的课程（Day2 - 随堂3）
     * @param pageQuery
     * @return
     */
    LearningLessonVO now();

    LearningLessonVO queryLessonByCourseId(Long courseId);

    /**
     * 5、删除指定课程信息（Day2 - 作业2）
     * @param userId
     * @param courseId
     */
    void deleteCourseFromLesson(Long userId, List<Long> courseIds);

    /**
     * 5、统计课程学习人数 (Day2- 作业3)
     * @return
     */
    Integer countLearningLessonByCourse(Long courseId);

    /**
     * 6、校验当前课程是否已经报名 (Day2- 作业4)
     * @return
     */
    Long isLessonValid(Long courseId);

}
